package net.zjitc.controller;

import net.zjitc.pojo.User;
import net.zjitc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Author admin
 * @Date 2019/3/27 14:50
 */
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping("toregister")
    public String toregister(){
        return "register";
    }
    @RequestMapping("register")
    public String register(User user){
        user.getUsername();
        user.getPASSWORD();
        user.getGender();
        user.getEmail();
        user.getTelephone();
        user.getIntroduce();
        user.getActiveCode();
        return "";

        }

    @RequestMapping("login")
    public String login(){
        return "login";
    }
    @RequestMapping("/checkLogin")
    public String checkLogin(User user, Model model){
        userService.login(user.getUsername(),user.getPASSWORD());
        if (user!=null){
            model.addAttribute("user",user);
            return "success";
        }else {
            return "false";
        }

    }
}





//    @RequestMapping("value=/testJson")
//    public String testJson(@RequestBody User user){
//        System.out.println(user);
//        return "list.jsp";
//
//    }

